import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
ImageBox = pg.GraphicsLayoutWidget()
vb = ImageBox.addViewBox(row=0, col=0)
vb.setAspectLocked(True) #锁定长宽比使得viewbox的形状为正方形
# self.Image = pg.imageItem()ImageItem经常与HistogramLUTItem或HistogramLUTWidget一起使用，以提供一个GUI来控制用于显示图像的级别和查找表。
#ImageItem(image=None, **kargs)
Image = pg.ImageItem()  #创建一个image item



# Lines
xCenter = pg.InfiniteLine(pen=(215, 0, 26), angle=90)
yCenter = pg.InfiniteLine(pen=(215, 0, 26), angle=0)

# Add Items to Viewbox
vb.addItem(Image)

# Plots

ImageBox.ci.layout.setColumnMaximumWidth(1, 100)
ImageBox.ci.layout.setRowMaximumHeight(1, 100)

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()